package org.biubiu0002.baiblog.im.api;

import com.google.common.base.Preconditions;
import org.apache.commons.lang3.StringUtils;
import org.apache.dubbo.config.annotation.DubboService;
import org.biubiu0002.baiblog.im.service.NotifyService;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: biubiu0002
 * @Date: 2022/12/20 13:44
 **/
@Component
@DubboService
public class NotifyApiServiceImpl implements NotifyApiService {

    @Resource
    private NotifyService notifyService;

    @Override
    public void notifyGroup(int type, List<String> uidList, String groupUid, String content) {
        checkType(type);
        Preconditions.checkArgument(!CollectionUtils.isEmpty(uidList),"目标uidList不能为空");
        Preconditions.checkArgument(StringUtils.isNotBlank(groupUid),"群聊uid不能为空");
        Preconditions.checkArgument(StringUtils.isNotBlank(content),"推送内容不能为空");
        notifyService.notifyGroup(type,uidList,groupUid,content);
    }

    private void checkType(int type){


    }
}
